<template>
  <el-button @click="f(1)">成功消息</el-button>
  <el-button @click="f(2)">警告消息</el-button>
  <el-button @click="f(3)">普通消息</el-button>
  <el-button @click="f(4)">危险消息</el-button>
</template>
<script setup>
import {ElMessage} from 'element-plus'
  const f = (x)=>{
    switch (x) {
      case 1:ElMessage.success("消息内容");
        break;
      case 2:ElMessage.warning("消息内容");
        break;
      case 3:ElMessage("消息内容");
        break;
      case 4:ElMessage.error("消息内容");
        break;
    }
  }
</script>

<style scoped>

</style>